package com.wzt.gift.fallback;

import com.wzt.gift.clients.UserClient;
import com.wzt.gift.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author Zenith
 * @Date 2022/10/19 9:36
 * @Version 1.0
 */
@Component
public class UserClientFallbackFactory implements FallbackFactory<UserClient> {
    @Override
    public UserClient create(Throwable throwable) {
        return new UserClient() {
            @Override
            public AjaxResult getByLoginId(Long id) {
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("系统繁忙，请稍后再试！");
            }
        };
    }
}
